package com.apex.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2     //开启Swagger2
public class SwaggerConfig {
    //    配置Swagger的Docket的bean实例
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo());
    }
//    配置Swagger 信息 = apiInfo
//    访问地址：  http://localhost:8080/swagger-ui/index.html

    private ApiInfo apiInfo() {
//        作者信息
        Contact contact = new Contact("George", "https://www.baidu.com", "@163.com");
//        具体信息
        return new ApiInfo(
                "Swagger测试文档",
                "不听老人言开心好几年",
                "V1.0",
                "https://www.baidu.com",
                contact,
                "Swagger2",
                "https://www.baidu.com",
                new ArrayList()
        );
    }
}